<%--
 * edit.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags"%>


<form:form action="comment/customer/create.do" modelAttribute="comment">
	<form:hidden path="id" />
	<form:hidden path="version" />
	<form:hidden path="customer" />
	<form:hidden path="painting" />
	<form:hidden path="children" />
	<form:hidden path="creationMoment" />


	<jstl:if test="${isNew}">
		<security:authorize access="hasRole('CUSTOMER')">
			<acme:textarea code="comment.text" path="text" />

			<acme:submit code="comment.create" name="save" />
		</security:authorize>
	</jstl:if>

	<jstl:if test="${isResponse}">
		<security:authorize access="hasRole('CUSTOMER')">
			<acme:textarea code="comment.text" path="text" />

			<acme:submit code="comment.create" name="save" />
		</security:authorize>
	</jstl:if>


	<jstl:if test="${!isNew}">
		<form:hidden path="parent" />

		<jstl:if test="${!isResponse}">
			<acme:textarea code="comment.text" path="text" readonly="true" />
		</jstl:if>
		<jstl:if test="${hasChildren}">
			<acme:cancel code="comment.children"
				url="comment/children.do?commentId=${childrenCommentId}" />

		</jstl:if>
		<jstl:if test="${hasParent}">
			<acme:cancel code="comment.parent"
				url="comment/edit.do?commentId=${parentCommentId}" />

		</jstl:if>

		<security:authorize access="hasRole('CUSTOMER')">
			<jstl:if test="${!isResponse}">
				<acme:cancel code="comment.respond"
					url="comment/customer/respond.do?commentId=${commentId}" />
			</jstl:if>
		</security:authorize>

	</jstl:if>
	<acme:cancel code="comment.goBack" url="${backURI}" />


</form:form>